// Copyright (C) 2005 Taylor L. Riché <riche@cs.utexas.edu>
//  
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software 
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// 	$Id: CppIncludes.java 70 2005-08-02 15:48:36Z richetl $	
//

import java.io.*;
import java.util.*;

class CppIncludes
{

    public class Include {
	private boolean sys;
	private String name;

	public Include() {
	    name = "";
	    sys = false;
	}

	public boolean isSys() {
	    return sys;
	}
	public void setSys(boolean v) {
	    sys = v;
	}
	public String getName() {
	    return name;
	}
	public void setName(String n) {
	    name = n;
	}
    }
    
    private LinkedList includeList;

    public CppIncludes() {
	includeList = new LinkedList();
    }

    public void print(PrintStream file) {
	Iterator includes = includeList.iterator();
	int listSize = includeList.size();
	for(int i = 0; i < listSize; i++) {
	    file.print("#include ");
	    Include inc = (Include)includes.next();
	    if(inc.isSys()) {
		file.println("<" + inc.getName() + ">");
	    }
	    else {
		file.println("\"" + inc.getName() + "\"");
	    }
	}
    }

    public void addInclude(Include i) {
	includeList.addLast(i);
    }
}
